// Copyright 2012 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

/**
 * @fileoverview Voltage controlled oscillator emulators.
 */
goog.provide('doodle.moog.OscillatorInterface');
goog.provide('doodle.moog.OscillatorInterface.FillMode');
goog.provide('doodle.moog.OscillatorInterface.Range');
goog.provide('doodle.moog.OscillatorInterface.WaveForm');



/**
 * Oscillator interface to be implemented in WebAudio and FlashAudio.
 * @interface
 */
doodle.moog.OscillatorInterface = function() {};


/**
 * Different methods in which an oscillator can fill an audio buffer.
 * @enum {number}
 */
doodle.moog.OscillatorInterface.FillMode = {
  // Clobber any pre-existing data in the buffer.
  CLOBBER: 0,
  // Add signal to the buffer.
  ADD: 1,
  // Add signal to the buffer and then do an even mix down.
  MIX: 2
};


/**
 * Different 'ranges' (i.e., octaves in synth lingo) in which an oscillator can
 * generate a tone.  'LO' is a special Moog-ism that generates sub-audio clicks
 * and pops.
 * @enum {number}
 */
doodle.moog.OscillatorInterface.Range = {
  LO: 0.0625,
  R32: 2,
  R16: 4,
  R8: 8,
  R4: 16,
  R2: 32
};


/**
 * Different wave forms that can be generated by an oscillator, each of which
 * has a different overtone spectrum leading to a different base timbre.
 * @enum {number}
 */
doodle.moog.OscillatorInterface.WaveForm = {
  TRIANGLE: 0,
  SAWANGLE: 1,
  RAMP: 2,
  REVERSE_RAMP: 3,
  SQUARE: 4,
  FAT_PULSE: 5,
  PULSE: 6
};


/**
 * Sets the volume on this oscillator.
 * @param {number} volume Volume in the range of [0, 1].
 */
doodle.moog.OscillatorInterface.prototype.setVolume = function(volume) {};


/**
 * Sets the wave form generated by this oscillator.
 * @param {!doodle.moog.OscillatorInterface.WaveForm} waveForm The wave form to
 *     use.
 */
doodle.moog.OscillatorInterface.prototype.setWaveForm = function(waveForm) {};


/**
 * Sets the pitch bend on this oscillator.
 * @param {number} pitchBend Pitch bend amount in the range of [-1, 1].
 */
doodle.moog.OscillatorInterface.prototype.setPitchBend = function(pitchBend) {};


/**
 * Sets the octave/range of this oscillator.
 * @param {!doodle.moog.OscillatorInterface.Range} range The range of this
 *     oscillator.
 */
doodle.moog.OscillatorInterface.prototype.setRange = function(range) {};


/**
 * Turns on keyboard pitch control.
 */
doodle.moog.OscillatorInterface.prototype.turnOnKeyboardPitchControl =
    function() {};


/**
 * Turns off keyboard pitch control.
 */
doodle.moog.OscillatorInterface.prototype.turnOffKeyboardPitchControl =
    function() {};


/**
 * Turns on frequency modulation.
 */
doodle.moog.OscillatorInterface.prototype.turnOnFrequencyModulation =
    function() {};


/**
 * Turns off frequency modulation.
 */
doodle.moog.OscillatorInterface.prototype.turnOffFrequencyModulation =
    function() {};


/**
 * Sets the modulation signal level.
 * @param {number} modulatorLevel If a modulator, how strong the modulator
 *     control signal should be [0..1].
 */
doodle.moog.OscillatorInterface.prototype.setModulatorLevel =
    function(modulatorLevel) {};


/**
 * Turns on glide.
 */
doodle.moog.OscillatorInterface.prototype.turnOnGlide = function() {};


/**
 * Turns off glide.
 */
doodle.moog.OscillatorInterface.prototype.turnOffGlide = function() {};


/**
 * Sets the duration of gliding.
 * @param {number} time The time to glide between notes in seconds.
 */
doodle.moog.OscillatorInterface.prototype.setGlideDuration = function(time) {};


/**
 * Sets the note this oscillator should generate.
 * @param {number} note Chromatic index of the note to be played relative to the
 *     beginning of the keyboard.
 */
doodle.moog.OscillatorInterface.prototype.setActiveNote = function(note) {};


/**
 * Sets the attack time for this oscillator's envelope generator.
 * @param {number} attackTime The new attack time.
 */
doodle.moog.OscillatorInterface.prototype.setEnvelopeGeneratorAttackTime =
    function(attackTime) {};


/**
 * Sets the decay time for this oscillator's envelope generator.
 * @param {number} decayTime The new decay time.
 */
doodle.moog.OscillatorInterface.prototype.setEnvelopeGeneratorDecayTime =
    function(decayTime) {};


/**
 * Sets the sustain level for this oscillator's envelope generator.
 * @param {number} sustainLevel The new sustain level.
 */
doodle.moog.OscillatorInterface.prototype.setEnvelopeGeneratorSustainLevel =
    function(sustainLevel) {};
